<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>项目管理系统</title>
		<link rel="stylesheet" rev="stylesheet" href="../css/style.css"
			type="text/css" media="all" />
		<script src="../../js/jquery1.9.js"></script>
		<script src="../../js/jquery.form.js"></script>
		<script charset="utf-8" src="../../js/kindeditor/kindeditor-min.js"></script>
		<script charset="utf-8" src="../../js/kindeditor/lang/zh_CN.js"></script>
		<script charset="utf-8" src="../../js/kindeditor/style/complex.js"></script>
		<style type="text/css">
<!--
.atten {
	font-size: 12px;
	font-weight: normal;
	color: #F00;
}
-->
</style>
	</head>

	<body class="ContentBody">
		<form id="form_id">
			<input type="hidden" id="contact_id" name="id"/>
			<div class="MainDiv">
				<table width="99%" border="0" cellpadding="0" cellspacing="0"
					class="CContent">
					<tr>
						<th class="tablestyle_title">
							联系人编辑页面
						</th>
					</tr>
					<tr>
						<td class="CPanel">

							<table border="0" cellpadding="0" cellspacing="0"
								style="width: 100%">
								<TR>
									<TD width="100%">
										<fieldset style="height: 100%;">
											<legend>
												编辑联系人
											</legend>
											<table border="0" cellpadding="2" cellspacing="1"
												style="width: 100%">

												<tr>
													<td nowrap align="right" width="13%">
														地址:
													</td>
													<td width="41%">
														<input id="contact_addr" name="addr" class="text"
															style="width: 250px" type="text" size="40" />
														<span class="red"> *</span>
													</td>
												</tr>
												<tr>
													<td nowrap align="right" width="13%">
														电 话:
													</td>
													<td width="41%">
														<input id="contact_tel" name="tel" class="text"
															style="width: 250px" type="text" size="40" />
														<span class="red"> *</span>
													</td>
												</tr>
												<tr>
													<td nowrap align="right" width="13%">
														传 真:
													</td>
													<td width="41%">
														<input id="contact_fax" name="fax" class="text"
															style="width: 250px" type="text" size="40" />
														<span class="red"> *</span>
													</td>
												</tr>
												<tr>
													<td nowrap align="right" width="13%">
														邮 编:
													</td>
													<td width="41%">
														<input id="contact_zip" name="zip" class="text"
															style="width: 250px" type="text" size="40" />
														<span class="red"> *</span>
													</td>
												</tr>
												<tr>
													<td nowrap align="right" width="13%">
														手 机:
													</td>
													<td width="41%">
														<input id="contact_mobile" name="mobile" class="text"
															style="width: 250px" type="text" size="40" />
														<span class="red"> *</span>
													</td>
												</tr>
												<tr>
													<td nowrap align="right" width="13%">
														联系人:
													</td>
													<td width="41%">
														<input id="contact_contact" name="contact" class="text"
															style="width: 250px" type="text" size="40" />
														<span class="red"> *</span>
													</td>
												</tr>
												<tr>
													<td nowrap align="right" width="13%">
														网 址:
													</td>
													<td width="41%">
														<input id="contact_website" name="website" class="text"
															style="width: 250px" type="text" size="40" />
														<span class="red"> *</span>
													</td>
												</tr>
												<tr>
													<td nowrap align="right" width="13%">
														E-mail:
													</td>
													<td width="41%">
														<input id="contact_email" name="email" class="text"
															style="width: 250px" type="text" size="40" />
														<span class="red"> *</span>
													</td>
												</tr>

											</table>
											<br />
										</fieldset>
									</TD>
								</TR>

							</TABLE>
						</td>
					</tr>
					<TR>
						<TD colspan="2" align="center" height="50px">
							<input type="button" id="save_input" name="Submit" value="保存"
								class="" />

							<input id="backList_id" type="button" name="Submit2" value="返回列表"
								class="" />
						</TD>
					</TR>
				</TABLE>


				</td>
				</tr>
				</table>

			</div>
		</form>

		<script>
		
		$(function(){
			jQuery.ajax( {
				type : 'GET',
				url : '../../contact/list.do',
				dataType : 'json',
				success : function(obj) {
					for (o in obj.contact){
						$('#contact_'+o).val(obj.contact[o]);
					}
					if(obj.contact.id){
						$('#save_input').val('修改');
					}
				},
				error : function() {
					alert('error');
				}
			});
			
			$('#save_input').click(function() {
				var btnObj = $(this);
	
				if ($('#news_title').val() == '') {
					alert('请输入标题');
					return;
				} else {
					$(this).attr('disabled', true);
					$(this).val('保存中...');
				}
				var formData = $('#form_id').serialize();
				jQuery.ajax( {
					type : 'POST',
					url : '../../contact/add.do',
					dataType : 'json',
					data : formData,
					success : function(obj) {
						btnObj.val('保存成功');
						alert('保存成功!');
						location.href = "listnews.htm?currPage=1";
					},
					error : function() {
						alert('error');
					}
				});
			});

			$('#backList_id').click(function() {
				location.href = "listnews.htm?currPage=1";
			});
		});
			
	
</script>
	</body>
</html>
